<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.pageInfoUtil }" var="pageInfoUtil"/>
<c:set value="${requestScope.response.data.list }" var="list"/>
<c:set value="${requestScope.cateResponse.data.list }" var="cateList" />
<jsp:useBean class="com.wsh.shop.users.pojo.AUsers" id="pojo"/>
<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<title>管理员列表 - 商城</title>
		<%@ include file="/common/include/title_back.jsp" %>
	</head>
	<body>
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
			管理员管理 <span class="c-gray en">&gt;</span> 管理员列表 <a
				class="btn btn-success radius r"
				style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新"><i
				class="Hui-iconfont">&#xe68f;</i></a>
		</nav>
		<div class="page-container">
			<form action="${rootPath }/back/AdminsBackServlet?method=adminsList" method="post">
				<div class="text-c">
					<input type="text" class="input-text" style="width: 250px" placeholder="输入关键字" 
					id="" name="keyword" value="${requestScope.keyword }">
					状态:
					<select name="status">
						<option value="" ${requestScope.status == '' ? 'selected' : ''}>请选择</option>
						<option value="1"  ${requestScope.status == '1' ? 'selected' : ''}>启用</option>
						<option value="0" ${requestScope.status == '0' ? 'selected' : ''}>禁用</option>
					</select>
					日期范围：
					<input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" 
					id="datemin" name="st" readonly="readonly" class="input-text" 
					 value="${requestScope.st }"
					style="width: 150px;">
					- 
					<input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" 
					id="datemax" name="ed" readonly="readonly" class="input-text" 
					value="${requestScope.ed }"
					style="width: 150px;">
					<button type="submit" class="btn btn-success" id="" name="">
						<i class="Hui-iconfont">&#xe665;</i> 搜索
					</button>
				</div>
			</form>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
					<!-- <a href="javascript:;" onclick="datadel()" class="btn btn-danger radius">
						<i class="Hui-iconfont">&#xe6e2;</i>
						批量删除
					</a> -->
					<%--
						onclick事件
						参数1:弹出选项卡的标题,
						参数2:url
						参数3:宽度
						参数4:高度
					 --%>
					<a href="javascript:;" onclick="admin_add('添加管理员','${rootPath}/back/AdminsBackServlet?method=adminsInsert','800','500')"
						class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>
						添加管理员
					</a>
				</span>
				<span class="r">共有数据：<strong>${requestScope.pageInfoUtil.totalRecord }</strong> 条
				</span>
			</div>
			<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer">
				<table class="table table-border table-bordered table-bg">
					<thead>
						<tr>
							<th scope="col" colspan="9">管理员列表</th>
						</tr>
						<tr class="text-c">
							<th width="25"><input type="checkbox" name="" value=""></th>
							<th width="40">ID</th>
							<th width="80">邮箱</th>
							<th width="80">真实姓名</th>
							<th width="90">手机</th>
							<th width="50">状态</th>
							<th width="140">创建时间</th>
							<th width="140">上次登陆时间</th>
							<th width="80">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${list }" var="listTemp" varStatus="stat">
							<tr class="text-c">
								<td><input type="checkbox" value="1" name=""></td>
								<td>${listTemp.id }</td>
								<td class="text-l" title="${listTemp.email }">
                                    <u style="cursor: pointer" class="text-primary href_info"
                                        onClick="article_add('查看','${rootPath}/back/AdminsBackServlet?method=adminsUpdate&id=${listTemp.id}','','510')" title="查看">
                                        ${fn:substring(listTemp.email,0,subStrLen) }
                                    </u>
                                </td>
								<td>${listTemp.name }</td>
								<td>${listTemp.phone }</td>
								<td class="td-status">
									<span class="label label-success radius">
										<%-- <c:choose>
											<c:when test="${listTemp.status == 1 }">
												启用
											</c:when>
											<c:when test="${listTemp.status == 0 }">
												禁用
											</c:when>
											<c:otherwise>
												未知
											</c:otherwise>
										</c:choose> --%>
										<!-- 默认调用get方法 -->
										${listTemp.statusStr}
									</span>
								</td>
								<td>${listTemp.createTime }</td>
                                <td>${listTemp.lastLoginTime }</td>
								<td class="td-manage">
									<!-- <a style="text-decoration: none" onClick="admin_stop(this,'10001')" href="javascript:;" title="停用">
										<i class="Hui-iconfont">&#xe631;</i>
									</a> -->
									<a title="编辑" href="javascript:;" onclick="admin_add('管理员编辑','${rootPath}/back/AdminsBackServlet?method=adminsUpdate&operType=update&id=${listTemp.id }','admins_edit_${listTemp.id }','800','500')"
										class="ml-5" style="text-decoration: none">
										<i class="Hui-iconfont">&#xe6df;</i>
									</a>
									<a style="text-decoration: none" class="ml-5" data-title="管理员重置密码" title="管理员重置密码"
	                                   data-href="${rootPath}/back/AdminsBackServlet?method=adminsUpdate&operType=updateResetPass&id=${oneTemp.id }"
	                                   onclick="Hui_admin_tab(this)"
	                                   href="javascript:;">
	                                    <i class="Hui-iconfont">&#xe63f;</i>
	                                </a>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				
				<form action="${rootPath }/back/AdminsBackServlet?method=adminsList" id="pageForm" method="post">
					<!-- 在每次提交的时候,将搜索条件放到表单中
						hidden:隐藏域,不会在页面上显示
					 -->
					<input type="hidden" name="keyword" value="${requestScope.keyword }">
					<input type="hidden" name="status" value="${requestScope.status }">
					<input type="hidden" name="st" value="${requestScope.st }">
					<input type="hidden" name="ed" value="${requestScope.ed }">
				
				    <div class="dataTables_info" id="DataTables_Table_0_info"
                      role="status" aria-live="polite">
                      共${pageInfoUtil.totalRecord }条,共${pageInfoUtil.totalPage}页
                  </div>
                  <div class="dataTables_paginate paging_simple_numbers"
                      id="DataTables_Table_0_paginate">
                      <a class="paginate_button previous disabled"
                          aria-controls="DataTables_Table_0" data-dt-idx="0" tabindex="0"
                          onclick="return pageFormSubmit('pageForm', 'currentPage', '1', 'pageSize','${pageInfoUtil.pageSize}')"
                          id="DataTables_Table_0_previous">
                          首页
                      </a>
                      <a class="paginate_button previous disabled"
                          aria-controls="DataTables_Table_0" data-dt-idx="0" tabindex="0"
                          onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.prePage}', 'pageSize','${pageInfoUtil.pageSize}')"
                          id="DataTables_Table_0_previous">
                          上一页
                      </a>
                      <a class="paginate_button next disabled" 
                          aria-controls="DataTables_Table_0" data-dt-idx="2" tabindex="0"
                          onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.nextPage}', 'pageSize','${pageInfoUtil.pageSize}')"
                          id="DataTables_Table_0_next">
                          下一页
                      </a>
                      <a class="paginate_button next disabled" 
                          aria-controls="DataTables_Table_0" data-dt-idx="2" tabindex="0"
                          onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.totalPage}', 'pageSize','${pageInfoUtil.pageSize}')"
                          id="DataTables_Table_0_next">
                          尾页
                      </a>
                      第<input type="text" class="paginate_button" id="currentPage" name="currentPage" value="${pageInfoUtil.currentPage }" size="5" maxlength="5">页
                      每页<input type="text" class="paginate_button" id="pageSize" name="pageSize" value="${pageInfoUtil.pageSize }" size="5" maxlength="5">条
                      <input type="submit" value="GO" class="paginate_button">
                  </div>
				</form>
			</div>
		</div>
		<%@ include file="/common/include/footer_back.jsp"%>
        
        <script type="text/javascript">
            $('.table-sort').dataTable({
                //"aaSorting" : [ [ 1, "desc" ] ],//默认第几个排序
                "bStateSave" : false,//状态保存
                "paging" : false,
                "info":false,
            });
    
            /*分类-添加*/
            function admin_add(title, url, w, h) {
                var index = layer.open({
                    type : 2,
                    title : title,
                    content : url
                });
                layer.full(index);
            }
        </script>
	</body>
</html>